#ifndef XSAN_DISK_H
#define XSAN_DISK_H

#include "xsan_types.h"
#include "xsan_error.h"
#include <stdint.h>
#include <stdbool.h>

// Forward declaration for SPDK bdev descriptor
struct spdk_bdev_desc;

#ifdef __cplusplus
extern "C" {
#endif

/**
 * @brief XSAN disk structure representing a physical storage device
 */
typedef struct xsan_disk {
    xsan_disk_id_t id;                    /* 磁盘UUID */
    char name[XSAN_MAX_NAME_LEN];         /* 磁盘名称 */
    char bdev_name[XSAN_MAX_NAME_LEN];    /* SPDK bdev名称 */
    uint64_t size_bytes;                  /* 总大小（字节） */
    uint64_t allocated_bytes;             /* 已分配大小（字节） */
    uint32_t block_size;                  /* 块大小（字节） */
    bool is_ssd;                          /* 是否为SSD */
    uint32_t state;                       /* 磁盘状态 */
    xsan_group_id_t group_id;             /* 所属磁盘组ID，如果未分配则为全0 */
    struct spdk_bdev_desc *bdev_descriptor; /* SPDK bdev描述符 */
    struct xsan_disk *next;               /* 链表指针 */
} xsan_disk_t;

#ifdef __cplusplus
}
#endif

#endif /* XSAN_DISK_H */ 